﻿using System.Collections.Generic;
using Abmemunit.Domain.Users;
using System.Web;

namespace Abmemunit.Services.Users
{
    /// <summary>
    /// User service interface
    /// </summary>
    public partial interface IUserService
    {
        /// <summary>
        /// gets a User by user name
        /// </summary>
        /// <param name="userName"></param>
        /// <returns>A user</returns>
        User GetUserByName(string userName);

        /// <summary>
        /// gets a user by email
        /// </summary>
        /// <param name="email"></param>
        /// <returns>A user</returns>
        User GetUserByEmail(string email);

        /// <summary>
        /// gets a User by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns>A User</returns>
        User GetUserById(int id);

        /// <summary>
        /// gets all users
        /// </summary>
        /// <returns>All users</returns>
        IEnumerable<User> GetUsers();

        
        /// <summary>
        /// Creates new User
        /// </summary>
        /// <param name="user"></param>
        void CreateUser(User user);

        /// <summary>
        /// Delete user
        /// </summary>
        /// <param name="id"></param>
        void DeleteUser(int id);

        /// <summary>
        /// Update User
        /// </summary>
        /// <param name="user"></param>
        void UpdateUser(User user);



        /// <summary>
        /// Commits pending changes
        /// </summary>
        void SaveUser();

        /// <summary>
        /// Checks user validity
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        bool ValidateUser(User user);

        UserRole GetUserRoleByRoleName(string roleName);

        /// <summary>
        /// Signin User
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="user"></param>
        /// <param name="createPersistentCookie"></param>
        void SignIn(HttpContextBase httpContext, User user, bool createPersistentCookie);

        /// <summary>
        /// Sign out
        /// </summary>
        void SignOut();

    }
}
